module.exports = (sql, params = null) => {
    const mysql = require('maysql');
    const conn = mysql.createConnection({
        host: 'localhost',
        user: 'root',
        password: 'root',
        database: 'bigevent', // 数据库一会创建 
    });
    return new Promise((resolve, reject) => {
        conn.connect();
        conn.query(sql, params, (err, result) => {
            err ? reject(err) : resolve(result);
        });
        conn.end();
    }).catch(err => {
        console.log(err.sqlMessage);
        //这里输出 err.message 也可以
    });
}